package com.jinsi.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jinsi.pojo.MmUser;
import com.jinsi.service.HanderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/hander")
public class HanderController {

    @Autowired
    private HanderService handerService;


    @RequestMapping("/getPage")
    public Map<String,Object> getPage(int page,int limit,String deptName,String allName){
        Map<String,Object> map = new HashMap<>();
        PageHelper.startPage(page,limit);
// 查询所有数据
        List<MmUser> all = handerService.getAll(deptName,allName);

        PageInfo<MmUser> info = new PageInfo<>(all);

        map.put("data",info.getList());
        map.put("count",info.getTotal());
        map.put("code",0);
        map.put("msg","成功");




        return map;
    }
}
